package cn.nexd.location.indoor;

/**
 * 定位配置.
 * Created by codngfish on 16/5/5.
 */
public final class NexdIndoorLocationConfiguration {
    /**
     * 定位模式:
     * <p/>
     * LOCATION_MODE_WIFI_ONLY : 只使用 Wifi
     * <p/>
     * LOCATION_MODE_BEACON_ONLY : 只使用 Beacon
     * <p/>
     * LOCATION_MODE_MIX : 使用 Wifi 与 Beacon
     */
    public enum LocationMode {
        LOCATION_MODE_WIFI_ONLY, LOCATION_MODE_BEACON_ONLY, LOCATION_MODE_MIX
    }

    public String appKey;
    public LocationMode locationMode;
    public int locationRate;
    //    public boolean smoothness;
    public String locationConfigPath;
     public int wifiCollectorRate;
     public int beaconCollectorRate;

    public NexdIndoorLocationConfiguration(Buidler buidler) {
        this.appKey = buidler.appKey;
        this.locationMode = buidler.locationMode;
        this.locationRate = buidler.locationRate;
//        this.smoothness = buidler.smoothness;
        this.locationConfigPath = buidler.locationConfigPath;
         this.wifiCollectorRate = buidler.wifiCollectorRate;
         this.beaconCollectorRate = buidler.beaconCollectorRate;
    }


    public static class Buidler {
        private String appKey = "";

        private LocationMode locationMode = LocationMode.LOCATION_MODE_WIFI_ONLY;

        private int locationRate = 1000;

        private boolean smoothness = false;

        private String locationConfigPath = "";
        private int wifiCollectorRate = 1000;
        private int beaconCollectorRate = 1000;

        public NexdIndoorLocationConfiguration build() {
            return new NexdIndoorLocationConfiguration(this);
        }

        /**
         * 设置 AppKey
         *
         * @param appKey
         */
        public Buidler setAppkey(String appKey) {
            this.appKey = appKey;
            return this;
        }

        /**
         * 设置定位模式
         *
         * @param locationMode WiFi Bluetooth
         */
        public void setLocationMode(LocationMode locationMode) {
            this.locationMode = locationMode;
        }

        /**
         * 设置定位频率,单位毫秒.
         *
         * @param locationRate
         */
        public void setLocationRate(int locationRate) {
            this.locationRate = locationRate;
        }

//        /**
//         * 设置 Wifi 的采样频率.单位为毫秒.
//         *
//         * @param wifiCollectorRate
//         */
//        public void setWifiCollectorRate(int wifiCollectorRate) {
//            this.wifiCollectorRate = wifiCollectorRate;
//        }
//
//        /**
//         * 设置 Beacon 的采样频率.单位为毫秒.
//         *
//         * @param beaconCollectorRate
//         */
//        public void setBeaconCollectorRate(int beaconCollectorRate) {
//            this.beaconCollectorRate = beaconCollectorRate;
//        }

//        /**
//         * 是否启用定位平滑效果.默认情况下不启用.
//         * 这是一个极度危险的选项,建议使用默认配置,在启用之前请与 SDK 开发人员联系.
//         *
//         * @param smoothness
//         */
//        public void setSmoothness(boolean smoothness) {
//            this.smoothness = smoothness;
//        }


        /**
         * 设置定位配置文件的存放目录.只在离线定位的情况下生效.
         * 如果开发者没有显式的配置该路径,那么将采用默认的最佳路径.
         *
         * @param locationConfigPath 定位配置的文件目录例如 /sdcard/nexd/location/
         */
        public void setLocationConfigPath(String locationConfigPath) {
            this.locationConfigPath = locationConfigPath;
        }
    }
}
